package com.java.simple.study.juc.p3;

import static com.java.simple.study.tool.Sleeper.sleep;

import lombok.extern.slf4j.Slf4j;

/**
 * @author zhoujl
 * @date 2022/5/7 20:09
 * @desc 线程八锁
 */
public class EightLock {

    public static void main(String[] args) {
        Number n1 = new Number();
        Number n2 = new Number();
        new Thread(() -> {
            n1.a();
        }).start();
        new Thread(() -> {
            n1.b();
        }).start();
    }

    public void test1() {
        int i = 10;
        i++;
    }

}


@Slf4j(topic = "c.Number")
class Number {

    public static synchronized void a() {
        sleep(1);
        log.debug("1");
    }

    public static synchronized void b() {
        log.debug("2");
    }

}



